Skip to content

feat: better image handling (auto resize & max size constraints)#26401

Merged
rekram1-node merged 20 commits into
devfrom
image-handling
May 10, 2026
Merged

feat: better image handling (auto resize & max size constraints)#26401
rekram1-node merged 20 commits into
devfrom
image-handling

Conversation

@rekram1-node
Copy link
Copy Markdown
Collaborator

@rekram1-node rekram1-node commented May 8, 2026

Closes #23570, #12068

opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

Comment thread packages/opencode/src/image/image.ts Outdated
Comment thread packages/opencode/src/image/image.ts Outdated
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

Comment thread packages/opencode/src/image/image.ts Outdated
Comment thread packages/opencode/src/session/prompt.ts
Comment thread packages/opencode/src/session/processor.ts Outdated
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

Comment thread packages/opencode/src/config/config.ts
Comment thread packages/opencode/src/session/prompt.ts Outdated
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

Comment thread packages/opencode/src/image/image.ts Outdated
Comment thread packages/opencode/src/session/prompt.ts
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 9, 2026
opencode-agent Bot added a commit that referenced this pull request May 10, 2026
opencode-agent Bot added a commit that referenced this pull request May 10, 2026
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

Comment thread packages/opencode/src/image/image.ts Outdated
@rekram1-node
Copy link
Copy Markdown
Collaborator Author

/review

{ message: info, parts: resolvedParts },
)

const parts = yield* Effect.forEach(resolvedParts, (part) =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for human discretion: this normalizes only the current prompt parts before they are saved, so an oversized image that is already stored in session history can still be replayed unchanged on the next model call. That leaves the unrecoverable-history case from #23570 in place for existing sessions or any bypassed path; consider adding a replay-time safeguard in MessageV2.toModelMessagesEffect to normalize or omit oversized media before sending it to the provider.

@rekram1-node rekram1-node merged commit 85ce6a5 into dev May 10, 2026
11 checks passed
@rekram1-node rekram1-node deleted the image-handling branch May 10, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session becomes unrecoverable when auto-generated screenshots exceed 2000px

1 participant